<template>
  <div class="fullscene">
    <div class="appMap"></div>
    <!-- <div class="btn" @click="handleExportModel">导出</div> -->
  </div>
</template>

<script>
import { onMounted, watch, onUnmounted } from 'vue'
import Home from '@/utils/home.js'
import { Map3d } from './index.js'
export default {
  name: 'FzMap',
  props: ['mapInfo', 'ids'],
  setup(props) {
    let FzMap = null
    watch(()=> props.ids, (curr) => {
      console.log('最新的值是~~~~~~~~~~~~~~~~~~~~~~~' + curr)
    },{deep: true})


    onMounted(async () => {
      let list = []
      console.log('我拿到的ids是' + JSON.stringify(props) + '~~~~~~~~~~~~~')
      let mapLists = await Home.getMapList({
      projectId:parseInt(props.ids),
      province:props.mapInfo&&props.mapInfo.cityName?  props.mapInfo.cityName: '',
      city:""
    })
    // 便利一下数据，将没有名称的去掉
    for(let i = 0; i < mapLists.length; i++) {
      if (mapLists[i]['key'].length> 1 && mapLists[i]['key'] != 'undefined') {
        list.push(mapLists[i])
      }
    }
      FzMap = new Map3d('.appMap', props.mapInfo, list)
      //   FzMap.start()
      console.log(FzMap)
    })

    onUnmounted(() => {
      FzMap = null
    })
  },
}
</script>

<style lang="scss">
.fullscene {
  width: 100%;
  height: 100%;
}
.appMap {
  width: 100%;
  height: 100%;
  .mapLabel {
    font-size: 12px;
    color: #fff;
    text-shadow: 0.5px 0.5px #48c1ff;
  }
  .barLabel {
    font-size: 12px;
    color: #fff;
    text-shadow: 1px 1px #48c1ff;
    .sort {
      display: inline-block;
      width: 15px;
      height: 15px;
      border-radius: 50%;
      text-align: center;
      background-color: #fff;
      color: #000;
      text-shadow: none;
    }
  }
}
.btn {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 999;
  color: #fff;
}
</style>
